package com.sundi.ecgeneralize.web;


import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.sundi.ecgeneralize.dto.GrouponDto;
import com.sundi.ecgeneralize.dto.ResultEntity;
import com.sundi.ecgeneralize.service.IEcGrouponService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 团购活动表 前端控制器
 * </p>
 *
 * @author Mht
 * @since 2020-03-03
 */
@RestController
@RequestMapping("/ecGroupon")
@CrossOrigin(value = "*",  allowCredentials = "true")
public class EcGrouponController {

        @Autowired
    IEcGrouponService grouponService;

        @RequestMapping("/getGroList")
    public ResultEntity getGroList(GrouponDto grouponDto){
            PageHelper.startPage(grouponDto.getPageNum(),grouponDto.getPageSize());
            List groList = grouponService.getGroList(grouponDto);
            PageInfo pageInfo = new PageInfo(groList);
            return ResultEntity.ok(pageInfo);
        }
}
